/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.gestionpymes.compra.persistencia;

import py.gestionpymes.proveedores.persistencia.Proveedor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import py.gestionpymes.compra.persistencia.enums.EstadoFacturaProveedor;
import py.gestionpymes.adm.persistencia.Cotizacion;
import py.gestionpymes.adm.persistencia.Moneda;

/**
 *
 * @author christian
 */
@Entity
@NamedQueries({@NamedQuery(name=FacturaProveedor.TODOS,query="select f from FacturaProveedor f")})
public class FacturaProveedor implements Serializable {
    
    public static final String TODOS = "py.gestionpymes.jpa.compra.FacturaProveedor.TODOS";
    
    @OneToMany(mappedBy = "facturaProveedor",cascade= CascadeType.ALL)
    private List<DetFacturaProveedor> detalles;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String numero;
    @Enumerated(EnumType.STRING)
    private EstadoFacturaProveedor estado;
    @ManyToOne
    private Proveedor proveedor;
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date creacion = new Date();
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date emision;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date cancelacion;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date anulacion;
    @ManyToOne
    private Moneda moneda;
    @ManyToOne
    private Cotizacion cotizacion;
    private double totaliva05;
    private double totaliva10;
    private double totaliva;
    private double totalexenta;
    private double totalgravada05;
    private double totalgravada10;
    private double totalgravada;
    private double totaldescuento;
    private double total;
    private double saldo;

    public List<DetFacturaProveedor> getDetalles() {
        return detalles;
    }

    public void setDetalles(List<DetFacturaProveedor> detalles) {
        this.detalles = detalles;
    }

    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public EstadoFacturaProveedor getEstado() {
        return estado;
    }

    public void setEstado(EstadoFacturaProveedor estado) {
        this.estado = estado;
    }

    
    public Cotizacion getCotizacion() {
        return cotizacion;
    }

    public void setCotizacion(Cotizacion cotizacion) {
        this.cotizacion = cotizacion;
    }

    public Date getCreacion() {
        return creacion;
    }

    public void setCreacion(Date creacion) {
        this.creacion = creacion;
    }

    public Date getEmision() {
        return emision;
    }

    public void setEmision(Date emision) {
        this.emision = emision;
    }

    public Moneda getMoneda() {
        return moneda;
    }

    public void setMoneda(Moneda moneda) {
        this.moneda = moneda;
    }

    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

    public Proveedor getProveedor() {
        return proveedor;
    }

    public void setProveedor(Proveedor proveedor) {
        this.proveedor = proveedor;
    }

    public double getTotal() {
        return total;
    }

    public void setTotal(double total) {
        this.total = total;
    }

    public double getTotaldescuento() {
        return totaldescuento;
    }

    public void setTotaldescuento(double totaldescuento) {
        this.totaldescuento = totaldescuento;
    }

    public double getTotalexenta() {
        return totalexenta;
    }

    public void setTotalexenta(double totalexenta) {
        this.totalexenta = totalexenta;
    }

    public double getTotalgravada() {
        return totalgravada;
    }

    public void setTotalgravada(double totalgravada) {
        this.totalgravada = totalgravada;
    }

    public double getTotalgravada05() {
        return totalgravada05;
    }

    public void setTotalgravada05(double totalgravada05) {
        this.totalgravada05 = totalgravada05;
    }

    public double getTotalgravada10() {
        return totalgravada10;
    }

    public void setTotalgravada10(double totalgravada10) {
        this.totalgravada10 = totalgravada10;
    }

    public double getTotaliva() {
        return totaliva;
    }

    public void setTotaliva(double totaliva) {
        this.totaliva = totaliva;
    }

    public double getTotaliva05() {
        return totaliva05;
    }

    public void setTotaliva05(double totaliva05) {
        this.totaliva05 = totaliva05;
    }

    public double getTotaliva10() {
        return totaliva10;
    }

    public void setTotaliva10(double totaliva10) {
        this.totaliva10 = totaliva10;
    }

    public double getSaldo() {
        return saldo;
    }

    public void setSaldo(double saldo) {
        this.saldo = saldo;
    }

    public Date getAnulacion() {
        return anulacion;
    }

    public void setAnulacion(Date anulacion) {
        this.anulacion = anulacion;
    }

    public Date getCancelacion() {
        return cancelacion;
    }

    public void setCancelacion(Date cancelacion) {
        this.cancelacion = cancelacion;
    }


    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FacturaProveedor)) {
            return false;
        }
        FacturaProveedor other = (FacturaProveedor) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.gestionpymes.jpa.stock.FacturaProveedor[id=" + id + "]";
    }

}
